package com.jeesite.modules.app.user.post;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jeesite.common.mapper.JsonMapper;
import com.jeesite.modules.app.user.web.AppUserController;
import com.jeesite.modules.conf.AppController;
import com.jeesite.modules.conf.MessageCode;
import com.jeesite.modules.sys.entity.Post;
import com.jeesite.modules.sys.service.PostService;

@Controller
@RequestMapping(value = "/app/user/post/")
public class AppPostController {
	private static final Logger logger=LoggerFactory.getLogger(AppPostController.class);
	  @ModelAttribute()  
	  public void alideUser(HttpServletRequest request,HttpServletResponse response){
		 String userId= request.getParameter("userId");
		 System.out.println(userId);
	  }
       @Autowired
       private PostService postService;
       @RequestMapping(value = "findList")
       public void findList(HttpServletRequest request,HttpServletResponse response){
    	Post post=new Post();
		List<Post> findList = postService.findList(post);
		JSONArray parseArray = JSONObject.parseArray(JsonMapper.toJson(findList));
		AppController.renderSuccessObject(response, parseArray, MessageCode.SUCCESS_ACK);
       }
}
